package com.example.backadmindemo.service.impl;

import com.example.backadmindemo.mapper.BigEventMapper;
import com.example.backadmindemo.pojo.BigEvent;
import com.example.backadmindemo.pojo.CustInfo;
import com.example.backadmindemo.service.BigEventService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class BigEventServiceImpl implements BigEventService {

    @Resource
    private BigEventMapper bigEventMapper;

    @Override
    public List<BigEvent> selectNormal(int currentPage, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        int startCurrentPage = (currentPage - 1) * pageSize;
        map.put("currentPage", startCurrentPage);
        map.put("pageSize", pageSize);
        return bigEventMapper.selectNormal(map);
    }

    @Override
    public List<BigEvent> selectAbnormal(int currentPage, int pageSize) {
        Map<String, Object> map = new HashMap<>();
        int startCurrentPage = (currentPage - 1) * pageSize;
        map.put("currentPage", startCurrentPage);
        map.put("pageSize", pageSize);
        return bigEventMapper.selectAbnormal(map);
    }

    @Override
    public Integer getNormalSum() {
        return bigEventMapper.getNormalSum();
    }

    @Override
    public Integer getAbnormalSum() {
        return bigEventMapper.getAbnormalSum();
    }

    @Override
    public void setAbnormal(int id) {
        bigEventMapper.setAbnormal(id);
    }

    @Override
    public void cancelAbnormal(int id) {
        bigEventMapper.cancelAbnormal(id);
    }
}
